-
Notifications
You must be signed in to change notification settings - Fork 5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix/18884 migrate avatar network #19079
Fix/18884 migrate avatar network #19079
Conversation
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
Hi @georgewrmarshall, I have updated the code after you suggestions in the Old PR. Please review it. I need your help to understand causation of error in test-deps-depcheck. Thanks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good. Left one suggestion that I missed in my last review. And it will need a rebase
/** | ||
* Props for the AvatarNetwork component | ||
*/ | ||
export interface AvatarNetworkProps extends BoxProps { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we could extend AvatarBaseProps
here instead of BoxProps and remove backgroundColor
, borderColor
, color
, as
types altogether?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that would be great.
@@ -20,7 +21,7 @@ export interface AvatarBaseProps extends TextProps { | |||
* 'AvatarBaseSize.Md'(32px), 'AvatarBaseSize.Lg'(40px), 'AvatarBaseSize.Xl'(48px) | |||
* Defaults to AvatarBaseSize.Md | |||
*/ | |||
size?: AvatarBaseSize; | |||
size?: AvatarBaseSize | AvatarNetworkSize; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure about this because if we carry on this pattern we will just end up with many variant types that AvatarBase accepts. There must be a TypeScript pattern that uses an argument type? I'm willing to proceed until we develop that pattern
Codecov Report
@@ Coverage Diff @@
## develop #19079 +/- ##
===========================================
- Coverage 69.35% 69.34% -0.01%
===========================================
Files 986 985 -1
Lines 37265 37263 -2
Branches 10002 10003 +1
===========================================
- Hits 25843 25839 -4
- Misses 11422 11424 +2
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @thebinij, one more suggestion
/** | ||
* The name accepts the string to render the first alphabet of the Avatar Name | ||
*/ | ||
name?: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should make this required so the AvatarNetwork always has a child
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I have made "name" to be required. And also omitted "children" from the Base like suggested in AvatarIcon's PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @thebinij, code is looking good could you please add a screencast from storybook of the component docs and stories to the PR description. That way we can ensure there is no visual regression and everything works as expected. Thanks!
Hi @georgewrmarshall, I have included the before and after screencast to the description. |
85379a1
to
a962795
Compare
Hey @thebinij, Thanks for your time and effort in creating this pull request. As you're probably aware we have identified an issue related to the typing of the |
a962795
to
f87390c
Compare
f87390c
to
5ec399f
Compare
Hi @georgewrmarshall, Is there anything I can update in the PR before so you approve to merge it? |
Blocked by #19572 |
fixing error fix textAlign added AvatarNetworkSize NetworkProps extends BaseProps instead of Boxprops omitted children from base, made name required replace deprecated and fix lint
5ec399f
to
724efad
Compare
@thebinij jumped in to help you out with some of the recent updates made the |
@@ -14,7 +14,7 @@ export enum AvatarBaseSize { | |||
Xl = 'xl', | |||
} | |||
|
|||
export interface Props extends TextStyleUtilityProps { | |||
export interface AvatarBaseStyleUtilityProps extends TextStyleUtilityProps { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@georgewrmarshall renamed the base props here to be consistent with how we have been doing it lately.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately we can't reassign enums you can sort of see what happens when using the storybook controls
Also not sure why the props table isn't showing up?
It would be helpful to update the Before/After screencasts to ensure the storybook still works
https://metamask.github.io/metamask-storybook/?path=/docs/components-componentlibrary-avatarnetwork--docs
ui/components/component-library/avatar-network/avatar-network.types.ts
Outdated
Show resolved
Hide resolved
…types.ts Co-authored-by: George Marshall <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good! One suggestion to remove the JS version of the Box
from avatar-network.stories.tsx
And can we update this line in the ui/components/component-library/avatar-network/README.mdx
to point to the TS Box props
The `AvatarNetwork` accepts all props below as well as all [Box](/docs/components-ui-box--default-story#props) component props
to
The `AvatarNetwork` accepts all props below as well as all [Box](/docs/components-componentlibrary-box--docs#props) component props
ui/components/component-library/avatar-network/avatar-network.stories.tsx
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks for your contribution @thebinij and supporting @garrettbear
Explanation
Screenshots/Screencaps
Before
before.mp4
After
after.mp4
Manual Testing Steps
No functional changes
Pre-merge author checklist
Pre-merge reviewer checklist
If further QA is required (e.g. new feature, complex testing steps, large refactor), add the
Extension QA Board
label.In this case, a QA Engineer approval will be be required.